<script>
    
$(document).ready(function() {  
    $( ".register" ).click(function() { 
         var url = $(this).attr('url');    
         $('#txtEmployeeId').val($(this).attr('rel'));    
         $('#txtApplyDateOld').val('');   
         $('#frmCompanyCode').attr('action', url);
         $( "#frmCompanyCode" ).submit();   
      
       
    });
    //
    $( ".useritem" ).click(function() { 
         var url = $(this).attr('url');      
         $('#txtEmployeeId').val($(this).attr('rel'));    
         $('#frmCompanyCode').attr('action', url);          
         $( "#frmCompanyCode" ).submit();   
       
    });
    //
    $( ".edit" ).click(function() { 
         var url = $(this).attr('url');  
         $('#txtEmployeeId').val($(this).attr('rel'));    
         $('#txtApplyDateOld').val($(this).attr('rel1'));    
         $('#frmCompanyCode').attr('action', url);  
         $( "#frmCompanyCode" ).submit(); 
         
       
    }); 
    //
    $('.pagination a').click(function(e) {
            e.preventDefault();
            var url = $(this).attr('href');
            if (url != 'javascript:void(0)') {
                $('#txtEmployeeId').val("<?php echo $employeeID ?>");  
                $('#frmCompanyCode').attr('action', url);
                $('#frmCompanyCode').submit();
            }
        });
 }); 
</script>

<form id="frmCompanyCode" action="" method="POST">
  <input type="hidden" id="txtEmployeeId" name="txtEmployeeId">      
  <input type="hidden" id="txtApplyDateOld" name="txtApplyDateOld">      
</form>

<div id="main_content">
    <h3><?php echo $title ?></h3>  
    <div class="form_search wrapSalaryInfo">
        <table width="400">
            <tr>
                <td >
                    <form>
                        <label><?php echo $lblemployeeName; ?>: </label> <label><a class="useritem" rel="<?php echo $employeeID ?>" url="<?php echo base_url('/employee/update'); ?>" href="javascript:void(0);" title="<?php echo dQuotes($employeeName); ?>"><?php echo dQuotes(subString($employeeName,15)); ?></a></label>
                        <a rel="<?php echo $employeeID ?>" url="/employee/bonus/update" href="javascript:void(0);" class="register"><?php echo $lblnewRegister; ?></a>
                    </form>
                </td>
            </tr>
        </table>
    </div> 
    <div class="table_list">
        <table width="500" border="0"  class="list_view_data leave-info" cellpadding="0" cellspacing="0">
            <tr align="center">
                <th><?php echo $lblOrder; ?></th>
                <th><?php echo $lblApplyDate; ?></th>
                <th><?php echo $lblBonus; ?></th>
                <th><?php echo $lblBonusInfo; ?></th>
                <th><?php echo $lblAction; ?></th>
                 <th><?php echo $this->lang->line('spl__Delete'); ?></th>
            </tr>
            <?php if ($data): ?>
                <?php foreach ($data as $item): 
                    $path=($item->Del_Flag==0) ? base_url()."public/sites/images/check-icon.png" : base_url()."public/sites/images/uncheck.gif";
                    ?>
                    <tr>
                        <td align="center" width="50" class="table_col"><?php echo ++$order; ?></td>
                        <td align="center" width="100" class="table_col"><?php echo date('Y/m', strtotime($item->ApplyDate)); ?></td>
                        <td align="center" width="100" class="table_col">  
                            <a href ="<?php echo base_url('/employee/' . $employeeID . '/bonus/update/' . strtotime($item->ApplyDate)); ?>">
                                <?php echo dQuotes($item->Bonus); ?>
                            </a>
                        </td>
                        <td align="center" width="150" class="table_col"><?php echo subString($item->BonusInfo,30,'...'); ?></td>
                        <td align="center">
                            <a class="edit" rel="<?php echo $employeeID ?>" rel1="<?php echo strtotime($item->ApplyDate) ?>" url="<?php echo base_url('/employee/bonus/update'); ?>" href="javascript:void(0);" >
                                <img src="<?php echo base_url() ?>public/sites/images/Pencil.png" width="15"/>
                            </a>
                        </td>
                        <td align="center"><img src="<?php echo $path;?>"/></td>
                    </tr> 
                <?php endforeach; ?>
            <?php endif; ?>
        </table>
        <?php if (!$data): ?>
            <div class="clr"></div>
            <div class="errormessage"><?php echo $message; ?></div>
        <?php endif ?>
    </div>
    <div class="clr"></div>
    <div class="pagination"><?php echo $pagi; ?></div>
</div>